package io.renren.modules.comment_data_1.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.modules.comment_data_1.dao.V9CommentData1Dao;
import io.renren.modules.comment_data_1.entity.V9CommentData1Entity;
import io.renren.modules.comment_data_1.service.V9CommentData1Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;


@Service("v9CommentData1Service")
public class V9CommentData1ServiceImpl extends ServiceImpl<V9CommentData1Dao, V9CommentData1Entity> implements V9CommentData1Service {
    @Autowired
    private V9CommentData1Dao v9CommentData1Dao;
    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        Integer pages = Integer.parseInt(params.get("page").toString());
        Integer limit = Integer.parseInt(params.get("limit").toString());
        int page = (pages -1)*limit;
        params.put("page",page);
        params.put("limit",limit);
        List<V9CommentData1Entity> list = v9CommentData1Dao.selectV9CommentData1(params);
        int count = v9CommentData1Dao.selectV9CommentData1Count(params);
        Page<V9CommentData1Entity> page1 = new Page<>(pages,limit);
        page1.setRecords(list);
        page1.setTotal(count);
        page1.setCurrent(pages);
        page1.setSize(limit);
        return new PageUtils(page1);
    }


}
